package functional.closure;

import java.util.function.IntSupplier;

/**
 * @ClassName AnonymousClosure
 * @PackageName functional.closure
 * @projectName myThread
 * @Description 
 * @Author games
 * @Date 2025/8/27 下午1:50
 * @Version 1.0
 */
public class AnonymousClosure {
    IntSupplier makeFun(int x) {
        int i = 0;
        // 同样规则的应用:
        // i++; // 非等同 final 效果
        // x++; // 同上
        return new IntSupplier() {
            public int getAsInt() { return x + i; }
        };
    }
}
